{include file="common_top.html"}
	{include file="common_head.html"}
	<style type="text/css">
	{literal}
		.datatable .data table td.filter .state-block{float:left;}
		.datatable .data table td.filter .filter-item label{font-size:12px;}
		.datatable .data table td.filter .file-block{float:left;line-height:30px;}
		.datatable .data table tr.filter td .btn{float:left;}
		.datatable.opr .data .msg .notification{margin-bottom:0px;}
		.datatable .data table .pagination.bb td{border-bottom:1px;}
	{/literal}
	</style>
</head>
<body class="mainbody">
	<div class="datatable">
		<div class="data"><table><tbody>
			<tr class="nobb filter"><td class="filter">
				<form action="/index.php?a=localization&m=list&t=ajax" method="post" class="form-filter">
					<input type="hidden" name="page" id="page" />
					<div class="filter-item clearfix">
						<div class="state-block">
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_CP}" id="state_{$smarty.const.MAPPING_STATE_CP}" /><label for="state_{$smarty.const.MAPPING_STATE_CP}">完成</label>
						</div>
						<div class="state-block">
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_TW}" id="state_{$smarty.const.MAPPING_STATE_TW}" /><label for="state_{$smarty.const.MAPPING_STATE_TW}">待翻</label>
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_TD}" id="state_{$smarty.const.MAPPING_STATE_TD}" /><label for="state_{$smarty.const.MAPPING_STATE_TD}">正翻</label>
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_TB}" id="state_{$smarty.const.MAPPING_STATE_TB}" /><label for="state_{$smarty.const.MAPPING_STATE_TB}">退翻</label>
						</div>
						<div class="state-block">
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_PW}" id="state_{$smarty.const.MAPPING_STATE_PW}" /><label for="state_{$smarty.const.MAPPING_STATE_PW}">待校</label>
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_PD}" id="state_{$smarty.const.MAPPING_STATE_PD}" /><label for="state_{$smarty.const.MAPPING_STATE_PD}">正校</label>
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_PB}" id="state_{$smarty.const.MAPPING_STATE_PB}" /><label for="state_{$smarty.const.MAPPING_STATE_PB}">退校</label>
						</div>
						<div class="state-block">
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_AW}" id="state_{$smarty.const.MAPPING_STATE_AW}" /><label for="state_{$smarty.const.MAPPING_STATE_AW}">待审</label>
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_AD}" id="state_{$smarty.const.MAPPING_STATE_AD}" /><label for="state_{$smarty.const.MAPPING_STATE_AD}">正审</label>
							<input type="checkbox" name="state[]" value="{$smarty.const.MAPPING_STATE_AB}" id="state_{$smarty.const.MAPPING_STATE_AB}" /><label for="state_{$smarty.const.MAPPING_STATE_AB}">退审</label>
						</div>
					</div>
					<div class="filter-item hide mfilter mgb15 mgt15" data-hide="true">
						<label>键</label><input type="text" name="key" class="txt w100" />
						<label>英</label><input type="text" name="content_new_en" class="txt w300" placeholder="用这项会很慢..." />
					</div>
					<div class="filter-item clearfix hide mfilter" data-hide="true">
						<div class="file-block filelist">
							{foreach from=$files.data item=file}
								<input type="checkbox" name="file[]" value="{$file.id}" id="file_{$file.id}" /><label for="file_{$file.id}">{$file.file_name_short} [ {$file.data_count - $file.wait_t_count - $file.wait_p_count - $file.wait_a_count} / {$file.data_count} ]</label>
							{/foreach}
						</div>
					</div>
				</form>
			</td><td class="w50">
				<input type="button" class="btn btn_morefilter" value="显示更多过滤项" />
			</td><td class="w50">
				<input type="button" class="btn btn_turnpage" data-page="1" value="提交过滤" />
			</td></tr>
		</tbody></table></div>
	</div>
	<div class="datatable opr">
		<div class="data"><table><tbody>
			<tr class="nobb">
				<td class="w50"><input type="button" class="btn btn_selall" value="选择全部" /></td>
				{if $smarty.session.USER.translation}<td class="w50"><input type="button" class="btn btn_occt" value="占领翻译" /></td>{/if}
				{if $smarty.session.USER.proof}<td class="w50"><input type="button" class="btn btn_occp" value="占领校对" /></td>{/if}
				{if $smarty.session.USER.audit}<td class="w50"><input type="button" class="btn btn_occa" value="占领审核" /></td>{/if}
				{if $smarty.session.USER.audit >= 2}<td class="w50"><input type="button" class="btn btn_backa" value="退回审核" /></td>{/if}
				<td class="msg"></td>
			</tr>
		</tbody></table></div>
	</div>
	<div class="datatable"><div class="data datalist"></div></div>
	<script type="text/javascript">
		var filetitle = {$filetitle|json_encode};
	{literal}
		function F_TurnPage(page){
			if(page > 0){
				$("#page").val(page);
			}
			$(".msg").html("");
			$.fn.dyAjaxForm($(".form-filter"), {dataType: "JSON", onEvent: {success: function(result){
				if(result.state){
					$(".datalist").html(result.data);
				}else{
					$.fn.notificationShow($(".msg"), result.message, "error");
				}
			}, error: function(jqXHR, textStatus, errorThrown){
				$.fn.notificationShow($(".msg"), "AJAX请求出错[" + errorThrown + "].", "error");
			}}});
		}
		function F_OccTask(opr){
			var has = false;
			$(".datalist .opr_file_key").each(function(){
				if($(this).is(":checked")){
					has = true;
				}
			});
			if(!has) return;

			$("#opr").val(opr);
			$(".msg").html("");
			$.fn.dyAjaxForm($(".form-opr"), {dataType: "JSON", onEvent: {success: function(result){
				if(result.state){
					F_TurnPage(0);
					$.fn.notificationShow($(".msg"), result.message, "success");
				}else{
					$.fn.notificationShow($(".msg"), result.message, "error");
				}
			}, error: function(jqXHR, textStatus, errorThrown){
				$.fn.notificationShow($(".msg"), "AJAX请求出错[" + errorThrown + "].", "error");
			}}});
		}
		$(".state-block").buttonset();
		$(".file-block").buttonset();
		$(".filelist label").each(function(){
			var id = $(this).attr("for");
			id = id.substr(5, id.length - 5);
			$(this).attr("title", filetitle[id]).tooltip({show: {effect: "slideDown", delay: 250}});
		});
		$(".btn_morefilter").click(function(){
			if($(".mfilter").data("hide")){
				$(this).val("隐藏更多过滤项");
				$(".mfilter").data("hide", false).slideDown(300);
			}else{
				$(this).val("显示更多过滤项");
				$(".mfilter").data("hide", true).slideUp(300);
			}
		});
		$("body").on("click", ".btn_turnpage", function(){
			var page = $(this).data("page");
			F_TurnPage(page);
		});
		$(".btn_selall").click(function(){
			var selall = false;
			$(".datalist .opr_file_key").each(function(){
				if(!$(this).is(":checked")){
					selall = true;
				}
			});
			$(".datalist .opr_file_key").each(function(){
				$(this).prop('checked', selall);
			});
		});
		$(".btn_occt").click(function(){
			F_OccTask("translation");
		});
		$(".btn_occp").click(function(){
			F_OccTask("proof");
		});
		$(".btn_occa").click(function(){
			F_OccTask("audit");
		});
		$(".btn_backa").click(function(){
			F_OccTask("back");
		});
	{/literal}
	</script>
{include file="common_copyright.html"}
{include file="common_bottom.html"}
